package com.xbongbong.pro.enums.menu.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.PlatFormEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: AI中心菜单列表
 * @Author: jiping.yang
 * @Date: 2022-09-20  13:59
 * @version: v1.0
 **/
@Getter
public enum AICenterMenuEnum {

    // AI销小帮
    AI_SALES_HELP("aiSalesHelp","/ai/salesHelp","","constant.chartI18Constant.ai_sales_help","icon-24px2x",true, PlatFormEnum.WEB.getValue(),""),
    // AI中心
    AI_CENTER("cloudCode_","#/AICenter","#/AICenter","constant.chartI18Constant.ai_center","icon-shouquan",false, PlatFormEnum.WEB.getValue(),"#5190ED"),
    // 数据工厂
    DATA_FACTORY("cloudCode_","#/alldata","#/alldata","constant.chartI18Constant.data_factory","web-icon-shezhi",false, PlatFormEnum.WEB.getValue(),"#5190ED"),
    ;


    private String alias;
    private String url;
    private String mobileUrl;
    private String name;
    private String icon;
    private boolean isParent;
    private String platform;
    private String color;

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }

    AICenterMenuEnum(String alias, String url, String mobileUrl, String name, String icon, boolean isParent, String platform, String color){
        this.alias = alias;
        this.url = url;
        this.mobileUrl = mobileUrl;
        this.name = name;
        this.icon = icon;
        this.isParent = isParent;
        this.platform = platform;
        this.color = color;
    }

    public static  AICenterMenuEnum getParent(){
        AICenterMenuEnum[] values = values();
        for(AICenterMenuEnum temp : values){
            if(temp.isParent){
                return temp;
            }
        }
        return null;
    }

    public static List<AICenterMenuEnum> getChildList(){
        List<AICenterMenuEnum> list = new ArrayList<>();
        AICenterMenuEnum[] values = values();
        for(AICenterMenuEnum temp:values){
            if( !temp.isParent){
                list.add(temp);
            }
        }
        return list;
    }

}
